package cn.com.bluemoon.daps.domp.api.param;

import lombok.Data;

import java.util.HashMap;
import java.util.Map;

/**
 * @author Jarod.Kong
 * @date 2021/7/23 15:11
 */
@Data
public class UserParamPacker implements DompParamToMap{
    private final String token;
    private String userId, userName;
    private int pageSize;

    public UserParamPacker(String token, String userId, String userName, int pageSize) {
        this.token = token;
        if (pageSize <= 0) {
            pageSize = 10;
        }
        this.userId = userId;
        this.userName = userName;
        this.pageSize = pageSize;
    }

    /**
     * model to Map and set method code
     *
     * @param methodCode mcode
     * @return map
     */
    @Override
    public Map<String, Object> toMap(String methodCode) {
        return new HashMap<String, Object>(){{
            put("token", token);
            put("userName", userName);
            put("id", userId);
            put("status", "1");
            put("pageSize", pageSize);
            put("offSet", 0);
            put("method", methodCode);
        }};
    }
}
